package templateMethod;

public abstract class CaffeineVeverageWithHook {

    public final void prepareRecipe(){
        boilWater();
        brew();
        pourInCup();
        if(customerWantsCondiments()){

            addCondiments();
        }
    }

    public void boilWater() {
        System.out.println("Boiling Water ");
    }
    public void pourInCup() {
        System.out.println("Pouring into cup");
    }

    public abstract void brew();

    public abstract void addCondiments();

    /********************************************
     *
     * 我们加上一个小小的条件语句，而该条件语句是否成立，是由这个方法来决定
     *
     * @return
     *********************************************/
    boolean customerWantsCondiments(){
        return true;
    }


}
